import { MiddlewareConsumer, Module, NestModule, RequestMethod } from '@nestjs/common';
import { WebArticleService } from './web-article.service';
import { WebArticleController } from './web-article.controller';
import { IPMiddleware } from 'src/middleware/ip'
import { VisitService } from '../visit/visit.service'

@Module({
  controllers: [WebArticleController],
  providers: [WebArticleService, VisitService]
})
export class WebArticleModule implements NestModule {
    configure(consumer: MiddlewareConsumer) {
        consumer.apply(IPMiddleware).exclude('web-article/recommend').forRoutes(
            { path: 'web-article', method: RequestMethod.GET },
            { path: 'web-article/:id', method: RequestMethod.GET }
        )
    }
}